#ifndef CDIALOGBAR_H
#define CDIALOGBAR_H

#include <QHBoxLayout>
#include <QLabel>
#include <QWidget>

#include "CBaseTitleBar.h"
#include "CToolButton.h"

class CDialogBar : public CBaseTitleBar {
    Q_OBJECT
public:
    explicit CDialogBar(QWidget *parent = nullptr);
    ~CDialogBar();

private:
    void init();

public:
    bool isMouseFree() const override;

    bool titleVisible() const;
    void setTitleVisible(bool titleVisible);

private:
    CToolButton *m_closeButton;
    QSpacerItem *m_spacerLeft;

    QHBoxLayout *m_layout;

    bool m_titleVisible;

    void handleClose();
    void handleWindowTitleChanged(const QString &title);

protected:
    void updateBarVisible() override;

signals:
    void closeRequested();
};

#endif // CDIALOGBAR_H
